/*
 * @(#) HealthMeasureType.java Nov 12, 2015
 * Copyright  2015 GPDI. All right reserved.
 */
package blog.sys.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author xuyubang
 * 聊天消息
 * @version 1.0 Nov 12, 2015
 */
@Entity
@Table(name = "t_chat_msg")
public class ChatMsg implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1L;

    // 
    private Integer id;
    //发送方用户
    private Integer userId;
    //发送方昵称
    private String nickName;
    //发送方头像
    private Integer avatar;
    //接收方
    private Integer toUserId;
    //内容
    private String content;
    //创建时间
    private Date createTime;
    //类型 1:文字 2：语音
    private Integer type;
    //状态
    private Integer status;
    // 语音时长
    private Integer duration;
    // 语音文件编号
    private Integer voiceFileId;

    private List<User> userList = new ArrayList<>();


    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "user_id")
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Column(name = "to_user_id")
    public Integer getToUserId() {
        return toUserId;
    }

    public void setToUserId(Integer toUserId) {
        this.toUserId = toUserId;
    }

    @Column(name = "content")
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Column(name = "type")
    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    @Column(name = "nickname")
    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Column(name = "avatar")
    public Integer getAvatar() {
        return avatar;
    }

    public void setAvatar(Integer avatar) {
        this.avatar = avatar;
    }

    @Column(name = "duration")
    public Integer getDuration() {
        return duration;
    }

    public void setDuration(Integer duration) {
        this.duration = duration;
    }

    @Column(name = "voice_file_id")
    public Integer getVoiceFileId() {
        return voiceFileId;
    }

    public void setVoiceFileId(Integer voiceFileId) {
        this.voiceFileId = voiceFileId;
    }

    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }



    @Override
    public String toString() {
        return "ChatMsg{" +
                "id=" + id +
                ", userId=" + userId +
                ", nickName='" + nickName + '\'' +
                ", avatar=" + avatar +
                ", toUserId=" + toUserId +
                ", content='" + content + '\'' +
                ", createTime=" + createTime +
                ", type=" + type +
                ", status=" + status +
                ", userList=" + userList +
                '}';
    }
}
